package com.wavehi.reactive8;

import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Flow;
import java.util.stream.Stream;

/**
 * @Author WaveHi
 * @Date 26/10/2021 下午 3:23
 * @Version 1.0
 * @Contact HJBWaveHi@163.com
 * @Description Demonstrate the use of reactor.
 */
public class UserReactor {

    public static void main(String[] args) {
        //
        Flux<Integer> just = Flux.just(1, 2, 3, 4);
        
        //
        Integer[] nums = {1, 2, 4, 5, 6, 6};
        Flux<Integer> integerFlux = Flux.fromArray(nums);

        //
        List list = Arrays.asList(nums);
        Flux.fromIterable(list);

        //
        Stream<Integer> stream = Arrays.stream(nums);
        Flux<Integer> integerFlux1 = Flux.fromStream(stream);

        just.map(t -> t * 2).subscribe(System.out :: print);

       just.subscribe(System.out :: println);

    }
}
